package com.springloadfactory;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.io.support.SpringFactoriesLoader;

import java.util.List;

/**
 * @author fanxiao  2022/2/17
 * @since 1.0.0
 */
@Slf4j
public class AppTest {

  public static void main(String[] args) {
	  //
//	  List<Eoo> eoos = SpringFactoriesLoader.loadFactories(Eoo.class, null);
//	  eoos.forEach(t -> t.eoo());
	  AnnotationConfigApplicationContext context =
			  new AnnotationConfigApplicationContext(AppConfig.class);
	  EooImpl eooImpl = (EooImpl) context.getBean("eooImpl");
	  eooImpl.eoo();
	  Eoo1Impl eoo1Impl = context.getBean(Eoo1Impl.class);
	  eoo1Impl.eoo();
	  Eoo2Impl eoo2Impl = (Eoo2Impl) context.getBean("eoo2Impl");
	  eoo2Impl.eoo();
//	  Eoo eoo = (Eoo) context.getBean("eooProvider");
//	  eoo.eoo();
	  log.info("----------------------------------------");
	  Foo foo = (Foo) context.getBean("fooProvider");
	  foo.foo();
  }
}